package com.px.chapter_Dec_1.logistics;

public class Test {
    public static void main(String[] args) {
        Box<String> boxs = new Box<>(30);
        Thread in=new Thread(()->{
            for (int i=0;i<100;i++){
                boxs.add(String.valueOf(i)+"号包子");
                System.out.println("制作"+i+"号包子");
            }
        });
        Thread out1=new Thread(()->{
            Thread.currentThread().setName("二号顾客");
            for (int i=0;i<50;i++){

                System.out.println(Thread.currentThread().getName()+"获得"+boxs.take());

            }
        });
        Thread out2=new Thread(()->{
            Thread.currentThread().setName("一号顾客");
            for (int i=0;i<10;i++){

                System.out.println(Thread.currentThread().getName()+"获得"+boxs.take());
            }
        });

        in.start();
        out1.start();
        out2.start();



    }
}
